package my.spring.transaction;

/**
 * @author fengbo
 * @date 2018/7/4
 */
public class TransactionResourceManager {

    private static ThreadLocal<Object> resources = new ThreadLocal<>();

    public static Object getResource() {
        return resources.get();
    }

    public static void bindResource(Object resource) {
        resources.set(resource);
    }

    public static Object unbindResource() {
        Object resource = getResource();
        resources.set(null);
        return resource;
    }
}
